package is.olsenolsen;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;

//
/**
 * @kennari Hj�lmt�r Hafsteinsson
 * @nemendur H�purinn "OlsenOlsen"
 * @version 1.0
 * @date 2011/09/15
 * 
 * @category class ByrjunarActivity
 * 
 * ByrjunarActivity er til �ess a� me�handla a�alramma verksins me�
 * tilheyrandi sk�ringatexta og "valsmellir", svokalla�a "menu" hnappa, sem
 * birtist �egar notandinn smelli � "MENU", sem er valsmellir snjalls�mans.
 */
//
public class ByrjunarActivity extends Activity 
{
	private Intent       intent;
	private MenuInflater inflater;
	//
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{ 
		super.onCreate(savedInstanceState); 
	    this.setContentView(R.layout.byrjunar_rammi);
	    //
	} // onCreate
	//
	/**
	 * @category Stef onCreateOptionsMenu
	 * @param menu
	 * @return true
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{
	     this.inflater = getMenuInflater();
	     this.inflater.inflate(R.menu.valmynd, menu);
	     return true;
	} // onCreateOptionMenu( . . . )
	//
	//
	/**
	 * @category Stef onOptionsItemSelected
	 * @param item
	 * @return true
	 */
	/**
	 * Forskilyr�i: Til er notendavi�m�t, sem birtist sem t�mabundinn
	 * upphafsramma (splash-screen), sem hverfur eftir �kve�inni valinni
	 * t�maskei� til d�mis 7 sek�ndur.
	 * 
	 * Eftirskilyr�i: Notandinn er f�r�ur yfir � n�sta ramma samkv�mt vali
	 * sem vi�komnandi hefur framkv�mt me� �v� a� �ta � vi�eigandi valhnappa
	 * a� undangenginni smelli � "MENU" takka snjalls�mans.
	 */
	@Override
	public boolean onOptionsItemSelected(MenuItem item)
	{
		//sleep(Fastar.TVAER_SEKUNDUR);
		switch (item.getItemId()) 
		{
		case R.id.alla_leiki:
			/*
			 * Fastayr�ing (st��ul�sing): Notandinn er b�inn a� �ta � valhnappa
			 * til �ess a� geta dregi� spil.
			 */
			Toast.makeText(this, R.string.menu_langa_vitleysa,
					             Toast.LENGTH_LONG).show();
			/*
			 * V�sa�ula: Fara yfir � ramma til �ess a� geta dregi� spil:
			 */
			/**
			 * "DragaSpilActivity":
			 */
			this.intent = new Intent(getApplicationContext(),LangaVitleysaActivity.class);
			this.startActivityForResult(this.intent, Fastar.SECONDARY_ACTIVITY_REQUEST_CODE);
			Bless.killApp(Fastar.SLOKKVA_ORUGGLEGA);
			break;
		case R.id.syna_spil:
			/*
			 * Fastayr�ing (st��ul�sing): Notandinn er b�inn a� �ta � valhnappa
			 * til �ess a� geta sko�a� spil.
			 */
			Toast.makeText(this, R.string.menu_syna_spil,
					             Toast.LENGTH_LONG).show();
			/*
			 * V�sa�ula: Fara yfir � ramma til �ess a� geta sko�a� spil:
			 */
			/**
			 * "SynaSpilActivity.java":
			 */
			this.intent = new Intent(getApplicationContext(),SynaSpilActivity.class);
			this.startActivityForResult(this.intent, Fastar.SECONDARY_ACTIVITY_REQUEST_CODE);
			Bless.killApp(Fastar.SLOKKVA_ORUGGLEGA);
			break;
		case R.id.verid_velkomin_aftur:
			/*
			 * Fastayr�ing: Notandinn er b�inn a� �ta � valhnappa
			 * til �ess a� geta h�tt � forritinu.
			 * 
			 * V�sa�ula: H�tta � forritinu:
			 * Kve�ja forriti� (Bless = Good Bye):
			 * Bless er nafni� � klasa, sem inniheldur
			 * stefinu "killApp". Stefi� er "syncronized",
			 * sem � �slensku m�tta ���a sem: "samstillt".
			 */
			Bless.killApp(Fastar.SLOKKVA_ORUGGLEGA);
			//
			break;
		} // switch
		return true;
	} // onOptionsItemSelected( . . . )
	//
} // class ByrjunarActivity.
